/*
 * @Description: 
 * @Author: 赵大壮
 * @Date: 2024-07-21 17:04:05
 * @LastEditTime: 2024-07-23 13:35:52
 * @LastEditors: 赵大壮
 */
/*
 * @Description: 
 * @Author: 赵大壮
 * @Date: 2021-12-06 17:18:37
 * @LastEditTime: 2021-12-06 17:36:29
 * @LastEditors: 赵大壮
 */
import { Component, Vue, Inject } from "vue-property-decorator";
import DZServiceVideo from "../../service/DZServiceVideo";
import UITinymceEditor from "@/components/ui-editor/UITinymceEditor.vue"
import nyMessageToast from "@/utils/NYMessageToast";
import DZServiceCompany from "@/views/公司管理/service/DZServiceCompany";
import DZServiceReport from "@/views/报告管理/service/DZServiceReport";
import nyNetwork from "@/api/nyBaseNetwork";
import DZModelType from "@/views/视频管理/model/DZModelVideoType";
@Component({
    components: { UITinymceEditor }
})
export default class Index extends Vue {

    s_video = new DZServiceVideo();

    s_report= new DZServiceReport();

    created() {
        this.s_report.net_list_all_company();
        this.s_video.m_video.id = (this.$route.query.id as string)
        if (this.s_video.m_video.id) {
            this.s_video.net_video_info();
        }
        this.s_video.net_list_type_dic();
    }

    mounted() {

    }

    beforeDestroy() {

    }

    action_select_file_cover(file) {
        if (file.status == "ready") {
            this.s_video.m_video.coverUrl = URL.createObjectURL(file.raw);
            this.s_video.net_upload_image(file.raw);
        }
    }
    action_select_file_video(file) {
        if (file.status == "ready") {
            if (file.size > 300 * 1024 * 1024) {
                nyMessageToast.error("视频不能超过300M")
                return;
            }
            this.s_video.m_video.videoUrl = URL.createObjectURL(file.raw);
            this.s_video.net_upload_video(file.raw);
        }
    }

    action_editor_change(text) {
        this.s_video.m_video.desc = text;
    }

    action_add_video() {
        if (this.s_video.m_video.id) {
            this.s_video.net_edit_video(() => {
                this.$router.back();
            })
        } else {
            this.s_video.net_add_video(() => {
                this.$router.back();
            })
        }
    }
}